#ifndef GRAPH_LEVEL_H
#define GRAPH_LEVEL_H
#define EDGE_LVL 4
#include "Level.h"


struct vertex
{
    int id_;
    int niveau_;
    vertex():id_(-1),niveau_(1){}
    vertex(int id,int n):id_(id),niveau_(n){}
    bool existe(){ return (id_!=-1 && niveau_ != 1 ); }
    bool operator<(const vertex& right) const
        {
            if(right.niveau_ != niveau_)
                return niveau_<right.niveau_;
            else
                return id_<right.id_;
        }
    bool operator==(const vertex& right) const
        {
            return (niveau_==right.niveau_ && id_==right.id_);
        }
        bool operator!=(const vertex& right) const
        {
            return (niveau_!=right.niveau_ || id_!=right.id_);
        }
};

class Graph_Level
{
    public:
        Graph_Level();
        Graph_Level(Joueur* j,TextManager* t);
        void add_vertex(vertex v);
        void add_edge(vertex a, vertex b,Type_Edge id);
        vertex getVertex(vertex a,Type_Edge b);
        void creerVertex(vertex a,Type_Edge b);
        Level* getLevel(vertex v);
        void exportGraphML();
        int getNiveau(vertex a,Type_Edge b);
        int getNbrNiveau(int niv);
        vertex searchPossibleVertex(vertex v,Type_Edge t);




    protected:
    private:
        Joueur* j_;
        TextManager* t_;
        map< vertex,map<Type_Edge,vertex> > graph_;
        map<vertex,Level*> graph_lvl_;

};

#endif // GRAPH_LEVEL_H
